﻿#ifndef VIDEOCALLTHREAD_H
#define VIDEOCALLTHREAD_H
#pragma once

#include <QObject>
#include <QTimer>
#include <QBuffer>
#include <QCamera>
#include <QCameraImageCapture>
#include <QCameraViewfinder>
#include <QPixmap>
#include <QImage>
#include <QBuffer>
#include <QThread>
#include <QString>
#include <QByteArray>
#include <QTcpSocket>

class VideoCallThread : public QThread
{
    Q_OBJECT
public:
    explicit VideoCallThread(QWidget *parent = nullptr,QString id="");
    QByteArray ImageToData(const QImage &image);
    QImage DataToImage(const QString &data);
    void run() override;
    void displayImage(int ,QImage img);
signals:
    void sendImg(QImage img);
    void sendImg2(QByteArray ba);
private:
    QCamera* camera;
    QCameraImageCapture* imgcaptrue;
    QCameraViewfinder *viewfinder;
    QTimer* timer;
    QTcpSocket* sock;
    QString id;             //记录id
};

#endif // VIDEOCALLTHREAD_H
